// 默认导出，接收时可以随意命名
import http from "@/utils/http";

// 获取轮播图数据
export function getBannerAPI(params = {}) {
  // 默认为1 商品为2
  // 通过一个解构赋值，给distributionSite参数赋予一个默认值1，不传值，那么就是1,
  const { distributionSite = "1" } = params;
  return http({
    url: "/home/banner",
    params: {
      distributionSite,
    },
  });
}

// 规范注释的写法
/**
 * @description: 获取新鲜好物
 * @param {*}
 * @return {*}
 */
export const findNewAPI = () => {
  return http({
    url: "/home/new",
  });
};

/**
 * @description: 获取人气推荐
 * @param {*}
 * @return {*}
 */
export const getHotAPI = () => {
  return http({
    url: "home/hot",
    method: "get",
  });
};

/**
 * @description: 获取所有商品模块
 * @param {*}
 * @return {*}
 */
export const getGoodsAPI = () => {
  return http({
    url: "/home/goods",
  });
};
